package com.google.code.coma.producer.publisher;

import com.google.code.coma.Coma;
import com.google.code.coma.domain.Part;
import com.google.code.coma.rmi.RMIManager;
import com.google.code.coma.rmi.storage.StorageService;

/**
 * Part publisher for RMI
 *
 * @author Bernhard Nickel, bernhard.nickel@gmail.co
 */
public class RmiPartPublisher extends AbstractPartPublisher implements PartPublisher {

    private StorageService<Part> partStorageService;

    public RmiPartPublisher(String factoryId) {
		super(factoryId);
        partStorageService = RMIManager.getStorageService(factoryId + "_" + Coma.PARTS_CONTAINER);
    }

    @Override
    public void publish(Part part) throws Exception {
        partStorageService.add(part);
    }

    @Override
    public void shutdown() {
        //Nothing todo
    }
}
